<?php
/**
 *      (C)2010-2023 荆门泽优软件有限公司.
 */
require_once('db/head.php');

 if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
	exit('Access Denied');
}

define('RSELF', 'action=plugins&operation=config&identifier=up6&pmod=lic_setting&ac=');

$ac = !empty($_GET['ac']) ? $_GET['ac'] : '';

if($ac=='save')
{
    $lic = $_POST["lic"];
    if(C::t('#up6#up6_setting')->count()>0)
    {
        $data=array("license"=>$lic);
        C::t('#up6#up6_setting')->update(1,$data);
    }
    else{
        $data=array("license"=>$lic);
        C::t('#up6#up6_setting')->insert($data);
    }
    cpmsg(lang('plugin/up6', 'lic_msg_suc'), RSELF, 'succeed');
}
else
{
    $lics = C::t('#up6#up6_setting')->fetch(1);
    if(count($lics)>0)
    {
        $lic = $lics["license"];
    }

    showformheader('plugins&operation=config&identifier=up6&pmod=lic_setting&ac=save');
    showtableheader();
    showsetting('授权码', 'lic', $lic, 'textarea', '', 0, '请在此输入授权码，注意必须输入完整</br><a target="_blank" href="http://www.ncmem.com">申请授权码</a>');
    showtablefooter();
    showsubmit('licsubmit');
    showformfooter();
}
//输出HTML
// echo <<<EOF
// <table>
// <tr>
// <td colspan="2">请在此页面配置授权码</td>
// </tr>
// <tr>
// <td>授权码：</td>
// <td><input></td>
// </tr>
// EOF;
?>
